#ifndef CELL_MAIN_H
#define CELL_MAIN_H

#include <QWidget>
#include <QDebug>
#include <QMouseEvent>
#include "dlg_setting.h"
#include <dlg_setting.h>
#include <QTcpSocket>
#include <QAbstractSocket>
#include <QDateTime>

QT_BEGIN_NAMESPACE
namespace Ui {
class Cell_Main;
}
QT_END_NAMESPACE

class Cell_Main : public QWidget
{
    Q_OBJECT

public:
    Cell_Main(QWidget *parent = nullptr);
    ~Cell_Main();

    virtual void mousePressEvent(QMouseEvent* event);
    virtual void mouseReleaseEvent(QMouseEvent* event);
    virtual void mouseMoveEvent(QMouseEvent* event);

    void tcp_connect();
    void dealClientRead();

private slots:
    void on_btn_set_clicked();

    void on_btn_close_clicked();

    void on_btn_min_clicked();

    void on_btn_max_clicked();

    void on_btn_send_clicked();

    void on_btn_clear_clicked();

    void dealPack(QByteArray arr);

private:
    Ui::Cell_Main *ui;
    bool m_isPressed = false;
    QPoint m_winRect;
    QPoint m_pressPoint;
    Dlg_Setting m_dlg;
    QTcpSocket m_socket;
    QByteArray m_buffer;
    int m_iPackCnt;
};
#endif // CELL_MAIN_H
